import LoginForm from "./components/LoginForm";
import SwitchDark from "@/components/SwitchDark";
import loginLeft from "@/assets/images/login_left.png";
import logo from "@/assets/images/logo.png";
import "./index.less";
import { useState, useEffect } from 'react'
// import { useHistory } from 'react-router-dom'
import request from '@/utils/request'




const Login = () => {
	// const history = useHistory()
	// const [entityInfo, setEntityInfo] = useState<EntityInfo>({} as EntityInfo)


	const checkLogin = () => {
		// request('appIsUserLogin').then(res => {
		// 	if (res.code === 0 && res.data) {
		// 		// res.data.isLogin && history.push('/')
		// 	}
		// })
	}

	const queryEntityInfo = () => {
		// request('appGetEntityByUrl').then(res => {
		// 	if (res.code === 0 && res.data) {
		// 		setEntityInfo(res.data)
		// 	}
		// })
	}



	useEffect(() => {
		checkLogin()
		queryEntityInfo()
	}, [])


	return (
		<div className="login-container">
			<SwitchDark />
			<div className="login-box">
				<div className="login-left">
					<img src={loginLeft} alt="login" />
				</div>
				<div className="login-form">
					<div className="login-logo">
						<img className="login-icon" src={logo} alt="logo" />
						<span className="logo-text">Hooks-Admin</span>
					</div>
					<LoginForm />
				</div>
			</div>
		</div>
	);
};

export default Login;
